HAL LTDC migration: List of applicable concepts

This section provides information about the HAL LTDC applicable architecture concepts.

Concepts for LTDC

Concept

Description

Separation of initialization and configuration functions

The initialization has been split into separate initialize and configure functions:

  • HAL_LTDC_Init(): initializes the LTDC according to the associated handle.

  • HAL_LTDC_SetConfig(): sets the configuration to the LTDC peripheral.

  • HAL_LTDC_Start(): starts the LTDC display.

Removal and conversion of init structure to configuration structure

The initialization structure has been removed and is now part of the HAL_LTDC_SetConfig() function.

Renaming of the handle structure

The handle structure has been renamed to hal_ltdc_handle_t.

Renaming unitary init structures

The LTDC_InitTypeDef structure has been replaced by hal_ltdc_config_t.

Remove MspInit and MspDeInit callbacks

The functions hal_ltdc_MspInit() and hal_ltdc_MspDeInit() are removed and replaced by a user-defined sequence for LTDC initialization and configuration.

Unitary configuration APIs

New APIs are introduced to get and set LTDC features.

Individual callback registration APIs replace global register and unregister functions

The callback registration is handled by specific functions for each LTDC event. These functions are used to register callback functions for different LTDC events.

Introduce specialized IRQ handlers

HAL_LTDC_IRQHandler is still available. Additional specialized HAL_LTDC_PPP_IRQHandler() are prvided.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL LTDC driver, and equivalent services are ensured through the static inline APIs.

Revised and optimized HAL state machine

The LTDC state machine has been reworked to ensure transitions of the peripheral functional states.

Revised and optimized HAL API status returns

The HAL LTDC functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_BUSY: in case of an ongoing process.

  • HAL_OK: in case of a successfully completed operation.

Revised and optimized HAL error management

The error management function has been renamed to HAL_LTDC_GetLastErrorCodes().

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL LTDC driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

The ASSERT_DBG_STATE and ASSERT_DBG_PARAM macros are used to check the parameters and state of the HAL LTDC driver.

Refactor the HAL inclusion model.

Update included file within hal_ltdc.h according to inclusion model.

Merge HAL extension files with common ones and remove the EX prefix from APIs.

Only one HAL LTDC header file is now available, and all the macros, defines, functions, etc., in hal_ltdc_ex.h are adapted and merged into hal_ltdc.h.

Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency.

The HAL LTDC driver provides a new API to retrieve the clock frequency: HAL_LTDC_GetClockFreq().

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Convert finite parameters, including LTDC instances, into enumerated types (enums) at the HAL level to enhance code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL LTDC functions start with HAL_LTDC. All HAL LTDC enum and struct start with hal_ltdc.